/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package autowus.gui.module;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import polaczenie.polacz;
/**
 *
 * @author Quark
 */
public class DaysReservationsPanel extends javax.swing.JPanel {
     DaysReservationModel m = new DaysReservationModel();
   polacz p = new polacz();
    /**
     * Creates new form DaysReservationsPanel
     */
    public DaysReservationsPanel() {
  
p.laczZBD();
m.setWizyty(p.pobierzWizytyPoPeselu(p.pobierzDzisiejsze()));
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();

        setMaximumSize(new java.awt.Dimension(890, 355));
        setMinimumSize(new java.awt.Dimension(890, 355));
        setPreferredSize(new java.awt.Dimension(890, 355));

        jTable1.setModel( m
        );
        jScrollPane1.setViewportView(jTable1);
        jTable1.getColumnModel().getColumn(0).setResizable(false);
        jTable1.getColumnModel().getColumn(0).setPreferredWidth(1);
        jTable1.getColumnModel().getColumn(4).setResizable(false);
        jTable1.getColumnModel().getColumn(4).setPreferredWidth(1);
        jTable1.getColumnModel().getColumn(5).setResizable(false);
        jTable1.getColumnModel().getColumn(5).setPreferredWidth(1);
        jTable1.addMouseListener(new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {

                jTable1.revalidate();

                m.wyczysc();
                m.setWizyty(p.pobierzWizytyPoPeselu(p.pobierzDzisiejsze()));
                for(int c=0; c<jTable1.getColumnCount();c++){
                    for  (int r=0; r<jTable1.getRowCount();r++){
                        System.out.println("r="+r+"c="+c);
                        m.getValueAt(r, c);
                    }
                }

            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 890, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 355, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTable1;
    // End of variables declaration//GEN-END:variables
}
